<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('指定货位出库')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label class="is-required">仓库：</label>
                            <select id="warehouseId" name="warehouseId" th:with="type=${session.warehouse}">
                                <!--								<option   th:value="${session.warehouseId}" th:text="${@dict.getDictLabel('${session.warehouseId}')}"></option>-->
                                <option th:each="dict : ${type}" th:text="${dict.warehouseName}" th:value="${dict.warehouseId}"></option>
                            </select>
                        </li>
                        <li>
                            <label>货位编码：</label>
                            <input type="text" name="cargoSpaceId"/>
                        </li>
                        <li>
                            <label>物品编码：</label>
                            <input type="text" name="productId"/>
                        </li>
                        <li>
                            <label>托盘条码：</label>
                            <input type="text" name="trayCode"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search('formId','bootstrap-table')"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('formId','bootstrap-table')"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="assignCargoOut()">
                <i class="fa fa-plus"></i> 盘点出库
            </a>
<!--            <span>出口：</span>-->
<!--            <select id="exitId"  class="btn btn-default" style="width:160px;color: #004d8c">-->
<!--                <option value="">请选择出口</option>-->
<!--                <option value="1">出口1</option>-->
<!--                <option value="2">出口2</option>-->
<!--                <option value="5">出口5</option>-->
<!--                <option value="6">出口6</option>-->
<!--                <option value="7">出口7</option>-->
<!--            </select>-->
        </div>
        <div id="div1" style="height:500px" class="col-sm-12 select-table table-bordered">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('stock:stock:edit')}]];
    var removeFlag = [[${@permission.hasPermi('stock:stock:remove')}]];
    var product_status = [[${@dict.getType('product_status')}]];
    var quality_status = [[${@dict.getType('quality_status')}]];
    var prefix = ctx + "stock/stock";

    $(function() {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "库存表",
            clickToSelect: true,//是否启用点击选中行
            height: $("#div1").height() / 1,
            singleSelect:true,
            uniqueId:"stockId",//表主键(用于修改和删除)
            sortName:"stockId",//必加排序 sortOrder: "asc"默认
            columns: [
                {
                    halign: 'center',
                    align:'center',
                    checkbox: true
                },


                {
                    field: 'stockId',
                    title: '库存编码',
                    halign: 'center',
                    align:'center'
                },
                {
                    field: 'cargoSpaceId',
                    title: '货位编码',
                    halign: 'center',
                    align:'center',
                    visible: false
                },
                {
                    field: 'cargoSpaceName',
                    title: '货位名称',
                    halign: 'center',
                    align:'center'
                },
                {
                    field: 'trayCode',
                    title: '托盘条码',
                    halign: 'center',
                    align:'center'
                },
                {
                    field: 'lotNo',
                    title: '批号',
                    halign: 'center',
                    align:'center'
                },
                {
                    field: 'productId',
                    title: '物品编码',
                    halign: 'center',
                    align:'center'
                },
                {
                    field: 'lineId',
                    title: '物品名称',
                    halign: 'center',
                    align:'center'
                },
                {
                    field: 'productGuid',
                    title: '规格说明',
                    halign: 'center',
                    align:'center'
                },
                {
                    field: 'productDetailId',
                    title: '比例号',
                    halign: 'center',
                    align:'center'
                },
                {
                    field: 'quantity',
                    title: '库存数量',
                    halign: 'center',
                    align:'center'
                },
                {
                    field: 'inClassName',
                    title: '供应商',
                    halign: 'center',
                    align:'center'
                },
                {
                    field: 'inType',
                    title: '入库类型',
                    halign: 'center',
                    align:'center'
                },
                {
                    field: 'inDate',
                    title: '入库日期',
                    halign: 'center',
                    align:'center'
                },
                {
                    field: 'backDate',
                    title: '回流日期',
                    halign: 'center',
                    align:'center'
                },

                {
                    field: 'stackingId',
                    title: '垛型',
                    halign: 'center',
                    align:'center'
                },
                {
                    field: 'inClassId',
                    title: '拣选标志',
                    halign: 'center',
                    align:'center'
                },
            ]
        };
        $.table.init(options);
    });


    function assignCargoOut() {
        var row = $("#bootstrap-table").bootstrapTable('getSelections');
        if (row.length==0){
            $.modal.alertWarning("请至少选择一条数据")
            return
        }
        // var exitId=$("#exitId").val();
        // if(exitId=="" || exitId==null){
        //     $.modal.alertWarning("请选择出口")
        //     return
        // }
        $.post("/pandian/assignCargoPd", {
            trayCode: row[0].trayCode,
            // exitId:exitId
        }, function (result) {
            $.modal.alertWarning(result.msg);
            window.location.reload();
        })
    }
</script>
</body>
</html>